
// Copyright (C) 2007 Richard Uhler
// This file is part of Esiply.
//
// Esiply is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, Version 2,
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include <assert.h>

#include "FormalParameterList.h"
#include "String.h"

FormalParameterList::FormalParameterList() 
{}

FormalParameterList::FormalParameterList(String* identifier)
{
    push_back(identifier);
}

FormalParameterList::FormalParameterList(const FormalParameterList& rhs)
{
    // Don't call this.
    assert(false);
}

void FormalParameterList::push_back(String* identifier)
{
    m_identifiers.push_back(identifier);
}

String* FormalParameterList::as_string() const
{
    String* str = new String("");
    String* comma = new String(",");
    if (!m_identifiers.empty())
    {
        str = String::add(str, m_identifiers.front());
    }
    for (unsigned int i = 1; i < m_identifiers.size(); i++)
    {
        String* toadd = String::add(comma, m_identifiers[i]);
        str = String::add(str, toadd);
    }
    return str;
}

